<?php

declare (strict_types=1);

namespace App\Model;


use Hyperf\Database\Model\Relations\HasOne;

/**
 * @property int $id
 * @property int $industry_id 文件系统id
 * @property int $link_id 关联id
 * @property int $type 类型 1集散地关联  2地标关联  3特产
 */
class LinkIndustry extends Model
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'fly_link_industry';
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [];
    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = ['id' => 'integer', 'industry_id' => 'integer', 'link_id' => 'integer', 'type' => 'integer'];

    /**
     * 关联可申请售后类型
     * @return HasOne
     */
    public function with_af_can_applys()
    {
        return $this->hasOne(AftersaleSet::class, 'id', 'link_id')
            ->select(['id', 'after_sell_type']);
    }
}